08. AMCL Launch File: Move Base Node
Move Base Node
Two nodes down, one node to go!
You will be working with the
move_base
package using which you can define a navigation goal position for your robot in the map, and the robot will navigate to that goal position. Note that this step is optional if you choose to use
teleop
node to control and localize your robot.
The
move_base
package is a very powerful tool. It utilizes a costmap - where each part of the map is divided into which area is occupied, like walls or obstacles, and which area is unoccupied. As the robot moves around, a local costmap, in relation to the global costmap, keeps getting updated allowing the package to define a continuous path for the robot to move along.
What makes this package more remarkable is that it has some built-in corrective behaviors or maneuvers. Based on specific conditions, like detecting a particular obstacle or if the robot is stuck, it will navigate the robot around the obstacle or rotate the robot till it finds a clear path ahead.
Add ROS
move_base
Node
Let's add the
move_base
node to the
amcl.launch
file:
<launch>
<!-- Map Server -->
...
<!-- AMCL Node -->
...
<!-- Move Base -->
<node name="move_base" pkg="move_base" type="move_base" respawn="false" output="screen">
</node>
</launch>
Remap
scan
Topic
Again, we need to
remap
the
scan
topic to the correct one.
<remap from="scan" to="<YOUR PACKAGE NAME>/laser/scan"/>
Add Parameters to
move_base
Node
Similar to the
amcl
node,
move_base
node requires a set of parameters to move the robot in the world. As we already know , we could use the
param
tag to specify the parameter. But when there are plenty of parameters, we could use the
rosparam
tag to include config files to set multiple parameters directly!
Planners
Add the following
param
tags to the
move_base
node:
<param name="base_global_planner" value="navfn/NavfnROS" />
<param name="base_local_planner" value="base_local_planner/TrajectoryPlannerROS"/>
Load Config Files
Then we need to create/get the config files and load them in the
launch
file:
$ cd ..
$ mkdir config
$ cd config
Download the
config
files from Udacity S3 bucket and add them to the
config
folder:
wget https://s3-us-west-1.amazonaws.com/udacity-robotics/Resource/where_am_i/config.zip
unzip config.zip
rm config.zip
These config files have a preset of parameters defined for you to navigate the robot if you choose to send navigation goal to the robot in testing.
Config Files
Now that we have the
config
files ready, we will include them in the
launch
file, in the
move_base
node:
<rosparam file="$(find udacity_bot)/config/costmap_common_params.yaml" command="load" ns="global_costmap" />
<rosparam file="$(find udacity_bot)/config/costmap_common_params.yaml" command="load" ns="local_costmap" />
<rosparam file="$(find udacity_bot)/config/local_costmap_params.yaml" command="load" />
<rosparam file="$(find udacity_bot)/config/global_costmap_params.yaml" command="load" />
<rosparam file="$(find udacity_bot)/config/base_local_planner_params.yaml" command="load" />
Well done! That was a lot of work. Let us move on!